﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RPGKata
{
    class Party
    {
        private String name;
        private List<Character> characters = new List<Character>();

        public Party()
        {
            Console.WriteLine();
            Console.WriteLine("Name this party");
            name = Console.ReadLine();

            bool makeAnotherCharacter = true; //whether or not the player will make another character. defaults to true so at least one character is made.

            while (makeAnotherCharacter)
            {
                Console.Write("Character Name: ");
                String charName = Console.ReadLine();

                Console.Write("Strength: ");
                int strength = Int32.Parse(Console.ReadLine());

                Console.Write("Dexterity: ");
                int dexterity = Int32.Parse(Console.ReadLine());

                Console.Write("Constitution: ");
                int constitution = Int32.Parse(Console.ReadLine());

                Weapon weapon = null;

                Console.WriteLine();
                Console.Write("Create Weapon? (Y/N): ");
                String yesOrNo = Console.ReadLine();

                if (yesOrNo.Equals("Y") || yesOrNo.Equals("y"))//figures out of the player wants to create a weapon. if so, queries for the stats. if not, assigns the weapon a null value
                {
                    Console.Write("Weapon Name: ");
                    String weaponName = Console.ReadLine();

                    Console.Write("Choose Strength(0) or Dexterity(1): ");
                    int baseValue = Int32.Parse(Console.ReadLine());

                    Console.Write("Damage: ");
                    int damage = Int32.Parse(Console.ReadLine());

                    weapon = new Weapon(weaponName, baseValue, damage);
                }

                Armor armor = null;

                Console.WriteLine();
                Console.Write("Create Armor? (Y/N): ");
                yesOrNo = Console.ReadLine();

                if (yesOrNo.Equals("Y") || yesOrNo.Equals("y"))//figures out of the player wants to create an armor. if so, queries for the stats. if not, assigns the armor a null value
                {
                    Console.Write("Armor Name: ");
                    String armorName = Console.ReadLine();

                    Console.Write("Protection: ");
                    int protection = Int32.Parse(Console.ReadLine());

                    Console.Write("Encumbrance: ");
                    int encumbrance = Int32.Parse(Console.ReadLine());

                    armor = new Armor(armorName, protection, encumbrance);
                }

                characters.Add(new Character(charName, strength, dexterity, constitution, weapon, armor));

                Console.WriteLine();
                Console.Write("Make another character? (Y/N): ");
                yesOrNo = Console.ReadLine();

                if (yesOrNo.Equals("n") || yesOrNo.Equals("N"))
                    makeAnotherCharacter = false;
            }
       } 

        public void output()//solely for testing purposes right now.
        {
            Console.WriteLine("*********************************");
            Console.WriteLine(name);
            foreach(Character c in characters)
            {
                c.output();
            }
        }
    }
}
